package com.demo.service;

import com.alibaba.fastjson.JSONObject;
import com.demo.Pojo.Books;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 处理服务降级,@FeignClient(服务名,处理降级的服务类)
 */
@FeignClient(name = "SpringCloud-Provider1",fallbackFactory = FeignBookServiceFallFactory.class)
@Component
public interface FeignBookServiceFall {

    @RequestMapping("book/queryBookById/{id}")
    Books queryById(@PathVariable("id") int id);

    @RequestMapping("/book/allBook")
    JSONObject queryAll();
}
